package impl.repository;

import interfaces.repository.BillingRepository;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import dao.AccessDatabase;
import domain.Billing;
import domain.Customer;

public class StubBillingRepositoryImpl implements BillingRepository{

	
	@Override
	public Billing findByIdCustomer(Customer customer) {
		Billing billing = null;
		try {
			AccessDatabase a = new AccessDatabase();
			Connection con = a.conectar();
			Statement st = con.createStatement();
			ResultSet rs = st.executeQuery("SELECT * FROM billing WHERE idCustomer='"+customer.getId()+"'");
			

			
				billing = new Billing(
						rs.getInt("idCustomer"),
						rs.getString("cardholder"),
						rs.getInt("idAddress"),
						rs.getString("phone"));
				
		
			con.close();

			return billing;
		} catch (SQLException e) {
			return null;
		}
	}

	@Override
	public Billing findByCardholder(String cardholder) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean edit(Billing before, Billing after) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean add(Billing billing) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean delete(Billing billing) {
		// TODO Auto-generated method stub
		return false;
	}

}
